<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <button id="wbk">文本框</button>
    <button id="xlk">下拉框</button>
    <button id="dx">单选</button>
    <button id="duo">多选</button>
    <button id="dhwb">多行文本</button>
    <button id="sub">提交</button>
    <div id="main"></div>
</body>
<script>
    var textNum = 1
    window.onload = function () {
        // 文本框
        document.getElementById('wbk').onclick = function () {
            var intObj = document.createComment('input')
            intObj.type = 'checkbox'
            var boxObj = document.createComment('div')
            var spanoObj = document.createComment('span')
            spanObj.innerHTML = '文本框' + textNum ++ + ':'
            boxObj.appendChild(spanObj)
            boxObj.appendChild(intObj)
            document.getElementById('main').appendChild(boxObj)
        }
        document.getElementById('sub').onclick = function () {
            var int = document.getElementsByName('input')
            for (let i = 0; i < int.length;i++) {
                
            }
        }


    }
</script>
</html>